/**
 * Created by 55456 on 2016/4/12.
 */
var shortDataTypes = require("../lib/sequelizex").DataTypes;
module.exports = (sequelize,DataTypes) => {
    return sequelize.define("Msg",{
        updatedAt:shortDataTypes.String(),
        createdAt:shortDataTypes.String(),
        sendID  : shortDataTypes.Int(),
        revID   : shortDataTypes.Int(),
        content : shortDataTypes.Text()
    },{
        timestamps:false,
        hooks:{
           beforeCreate:function(msg){
               msg.createdAt = Math.round(new Date().getTime()/1000);
               msg.updatedAt = Math.round(new Date().getTime()/1000);
           },
           beforeUpdate:function(msg){
               msg.updatedAt = Math.round(new Date().getTime()/1000);
           }
        }
    });
};